package com.yc.thread.interrupte;

public class InterruptJoin {
	
	/**
	 * 中断join
	 * 效果：无效
	 */
	public void m() {
		Thread t1 = new Thread(() -> {
			for (int i = 0; i < 100000; i++) {
				System.out.println(i);
			}
		});
		t1.start();
		
		new Thread(() -> {
			t1.interrupt();
		}).start();
		
		try {
			System.out.println("-----------1");
			t1.join();//当前线程等着，让t1先走完
			System.out.println("-----------2");
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		
	}

	public static void main(String[] args) {
		InterruptJoin tj = new InterruptJoin();
		tj.m();

	}

}
